<template>

    <el-container style="height: 500px; border: 1px solid #eee">
        <!-- 左侧 -->
        <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
            <el-menu :default-openeds="['1', '2','3']" :default-active="'/' + $route.name" router>
                <el-submenu index="1">
                    <template slot="title"><i class="el-icon-message"></i>导航一</template>
                        <el-menu-item :index="$router.options.routes[0].children[0].path" :class="$route.name == $router.options.routes[0].children[0].path ? 'is-active':'' " >页面1</el-menu-item>
                    <el-menu-item :index="$router.options.routes[0].children[1].path" :class="$route.name == $router.options.routes[0].children[1].path ? 'is-active':'' ">页面2</el-menu-item>
                </el-submenu>

                <el-submenu index="2">
                    <template slot="title"><i class="el-icon-menu"></i>导航二</template>
                    <el-menu-item :index="$router.options.routes[1].children[0].path" :class="$route.name == $router.options.routes[1].children[0].path ? 'is-active':'' ">页面3</el-menu-item>
                    <el-menu-item :index="$router.options.routes[1].children[1].path" :class="$route.name == $router.options.routes[1].children[1].path ? 'is-active':'' ">页面4</el-menu-item>
                </el-submenu>
            </el-menu>
<!--            <el-menu :default-openeds="['0', '1','2']" :default-active="'/' + $route.name" router>-->
<!--                <el-submenu v-for="(item,index) in $router.options.routes" :index="index + ''">-->
<!--                    <template slot="title"><i class="el-icon-message"></i>{{item.name}}</template>-->
<!--                    <el-menu-item v-for="(page,index) in item.children"  :index="page.path" :class="$route.name == page.path ? 'is-active':'' " >{{page.name}}</el-menu-item>-->
<!--                </el-submenu>-->

<!--            </el-menu>-->
        </el-aside>

        <el-container>
            <el-header style="text-align: right; font-size: 12px">
                <el-dropdown>
                    <i class="el-icon-setting" style="margin-right: 15px"></i>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item>查看</el-dropdown-item>
                        <el-dropdown-item>新增</el-dropdown-item>
                        <el-dropdown-item>删除</el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>
                <span>王小虎</span>
            </el-header>

            <el-main>
                <router-view></router-view>
            </el-main>

        </el-container>
    </el-container>

</template>

<style>
    .el-header {
        background-color: #B3C0D1;
        color: #333;
        line-height: 60px;
    }

    .el-aside {
        color: #333;
    }
    .router-link-active {
        color: red;
    }
</style>

<script>

    export default {
        data() {
            const item = {
                date: '2016-05-02',
                name: '王小虎',
                address: '上海市普陀区金沙江路 1518 弄'
            };
            return {
                tableData: Array(20).fill(item)
            }
        },
        methods: {

        },
        created() {
            console.log("$router.options.routes",this.$router.options.routes)
            console.log("",this.$route)
        }
    };
</script>
